/*  

Cafechess Library: Cover basic chess programming needs, like GUI, Engine integration, 
FEN and PGN parsing.

                 \\|//
                 (o o)
--------------ooO-(_)-Ooo----------------------------------
Copyright (C) 2009  By Gregory A. Prentice Snoqualmie, WA
                    www.cafechess.org
                    cafechess@comcast.net
                      Oooo
--------------oooO----(  )---------------------------------
              (  )    (_/
               \_)

Microsoft Public License (Ms-PL)
               
Revisions:

Author        Date    Description:

*/
using System;
using System.IO;
using Cafechess.Chess.General;
namespace Cafechess.Chess.Parsers
{
  #region PositionParser
  /// <summary>
  /// An interface that defines the minimal functionality that must
  ///   be implemented to allow the setup of a chess position. 
  ///   Normally used for a FEN or EDP parser that needs to setup
  ///   a position in multiple places such as a validation engine
  ///   and the bitmap dislay of the pieces.
  /// </summary>
  public interface IPosition
  {
    /// <summary>
    /// Used to parse out a position calling the events as needed
    ///   to inform the using class of what's happening.
    /// </summary>
    /// <param name="str"></param>
    void Parse(string str);
    /// <summary>
    /// Used to parse out a position calling the events as needed
    ///   to inform the using class of what's happening.
    /// </summary>
    void Parse(Stream ioStream);
    /// <summary>
    /// Used to register event handlers.
    /// </summary>
    /// <param name="ievents"></param>
    void AddEvents(IPositionEvents ievents);
    /// <summary>
    /// Used to remove event handlers.
    /// </summary>
    /// <param name="ievents"></param>
    void RemoveEvents(IPositionEvents ievents);
  }
  /// <summary>
  /// Defines the events that the IPosition class will need to fire to allow
  ///   the proper setup of a chess position.
  /// </summary>
  public interface IPositionEvents
  {
    /// <summary>
    /// Used to inform a subscriber that a new piece needs to be
    ///  placed onto a square.
    ///  </summary>
    /// <param name="piece"></param>
    /// <param name="square"></param>
    void PlacePiece(Pieces piece,int square);
    /// <summary>
    /// Used to inform a subscriber who's move it is.    
    /// </summary>
    /// <param name="bColor">True for white else false for black</param>
    void SetSideToMove(bool bColor);
    /// <summary>
    /// Used to inform a subscriber the state of castling.
    /// </summary>
    /// <param name="WK"></param>
    /// <param name="WQ"></param>
    /// <param name="BK"></param>
    /// <param name="BQ"></param>
    void SetCastling(bool WK, bool WQ, bool BK, bool BQ);
    /// <summary>
    /// The target square for Enpassant Captures.  Note per the standard
    /// There does not nessasarily need to be a pawn on either sided that
    /// can fullfill the capture.
    /// </summary>
    /// <param name="Enpassant"></param>
    void SetEnpassant( string Enpassant );
    void SetHalfMoves(int number);
    void SetFullMoves(int number);
    /// <summary>
    /// Called when we are done parsing/setting up the position.
    /// </summary>
    void Finished();
    /// <summary>
    /// Called when we are about to begin 
    /// </summary>
    void Starting();
  }
  #endregion
}
